package com.koron.order.risk.base.controller;


import com.koron.bean.base.Response;
import com.koron.common.core.config.ThreadLocalContext;
import com.koron.order.risk.base.bean.po.LineRiskPart;
import com.koron.order.risk.base.service.LineRiskPartService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.koron.ebs.mybatis.ADOConnection;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 风险管控单(LineRisk)表控制层
 *
 * @author jzp
 * @since 2022-12-15 16:17:58
 */
@Slf4j
@Api(tags = "风险管控单设备接口")
@RestController
@RequestMapping("lineRiskPart")
public class LineRiskPartController {

    @Autowired
    private LineRiskPartService lineRiskPartService;

    private String getCurrDs() {
        return ThreadLocalContext.get().getCurrDs();
    }

    @ApiOperation(value = "根据风险管控单查询设备信息")
    @GetMapping("listByRiskIds")
    public Response<List<LineRiskPart>> listByRiskIds(@RequestParam List<String> riskIds) {
        return Response.ok(ADOConnection.runTask(getCurrDs(), lineRiskPartService, "listByRiskIds", List.class, riskIds));
    }

}
